<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});
//Route::get('/getUsersPicture','\App\Http\Controllers\Api\UserController@getUsersPicture');//获取用户的图片


$api = app('Dingo\Api\Routing\Router');
$api->version('v1', function ($api) {
    $api->post('/users',function(){return 111;});
//    $api->post('jwt', 'App\Api\Controllers\UserController@authenticate');
//    $api->get('jwt', 'App\Api\Controllers\UserController@getUserFromToken');

    //用户
    $api->post('login','App\Http\Controllers\Api\LoginController@login');//登录 
   $api->post('register','App\Http\Controllers\Api\LoginController@register');//注册
   $api->post('getOpenId','App\Http\Controllers\Api\LoginController@getOpenId');//获取用户openID
    $api->post('updateUser','App\Http\Controllers\Api\LoginController@update');//更新

    //图片
    $api->post('uploadPicture','App\Http\Controllers\Api\PictureController@upload');//上传图片
    $api->post('quitMatch','App\Http\Controllers\Api\PictureController@quitMatch');//暂时退赛
    $api->post('addHealthPoint','App\Http\Controllers\Api\PictureController@addHealthPoint');//增加血量

    //比赛
    $api->get('getMatchPicture','App\Http\Controllers\Api\MatchController@getPictrue');//获取比赛的图片
    $api->post('postMatchPicture','App\Http\Controllers\Api\MatchController@postPicture');//上传比赛结果
    $api->get('clearUserMatchRdis','App\Http\Controllers\Api\MatchController@clearUserMatchRdis');//清空服务器的redis用户的图片id缓冲
    //升级
    $api->get('upgrade','App\Http\Controllers\Api\MatchController@userUpgrade');//升级测试

    //用户
    $api->get('getUsersPicture','App\Http\Controllers\Api\UserController@getUsersPicture');//获取用户的图片
    $api->get('addTicket','App\Http\Controllers\Api\UserController@addTicket');//增加用户的票
});
